import pygame, math, sys, random, time

class Timer():
    def __init__(self, position):
        self.font = pygame.font.Font(None, 60)
        self.startTime = time.time()
        self.currentTime = 0
        self.color = (190, 100, 200)
        self.surface = self.font.render(str(self.currentTime), 1, self.color)
        self.rect = self.surface.get_rect(centerx=position[0], centery=position[1])
            
    def place(self, pt):
        self.rect.center = pt
        
    def start(self):
        self.startTime = time.time()
        self.currentTime = time.time() - self.startTime
    
    def update(self):
        self.currentTime = time.time() - self.startTime
        self.surface = self.font.render(str(self.currentTime), 1, self.color)